package util

import "github.com/bwmarrin/snowflake"

var defaultNode *snowflake.Node

func init() {
	var err error
	defaultNode, err = snowflake.NewNode(1)
	if err != nil {
		panic(err)
	}
}

func NextSnowFlakeID() int64 {
	id := defaultNode.Generate()
	return id.Int64()
}

func NewSnowFlake(node int64) (n *snowflake.Node, err error) {
	return snowflake.NewNode(node)
}
